package cn.czu.wyw.controller;

import cn.czu.wyw.annocation.LogAnnotation;
import cn.czu.wyw.utils.CommonJsonResult;
import cn.czu.wyw.utils.RedisUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author swg.
 * @Date 2020/4/8 22:12
 * @CONTACT 317758022@qq.com
 * @DESC
 */
@Api(value = "Redis Demo",tags = "Redis测试")
@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    RedisUtil redisUtil;


    @ApiOperation("set")
    @GetMapping("/set")
    @LogAnnotation
    public CommonJsonResult set(@RequestParam("key") String key,@RequestParam("value") String value){
        redisUtil.set(key,value);
        return CommonJsonResult.ok(HttpStatus.OK);
    }

    @GetMapping("/delete")
    public CommonJsonResult delete(){
        return CommonJsonResult.ok();
    }

    @GetMapping("/update")
    public CommonJsonResult update(){
        return CommonJsonResult.ok();
    }
}
